package main

import (
	"fmt"
	//tt "test-go/day4/tt"
)

type test_profile struct {
	name    string
	age     int
	hobbies []string
}

func main() {
	fmt.Println("hello world")
	t7()
}

func t8() {

}

func t7() {
	s7 := test_test1{name: "pp", age: 10}
	res := s7.get_child("pp", 20)
	fmt.Println(res)
}

func t6() {

	var test struct {
		name string
		age  int
	}

	test.name = "haha"
	test.age = 10
	fmt.Println(test)
}

func t5() {
	t5 := struct {
		name string
		age  int
	}{
		name: "jj",
		age:  0,
	}

	fmt.Println(t5)
}

func t4() {
	t4 := test_profile{name: "gg", age: 20}

	s4 := &t4
	fmt.Println(s4.name)
}

func t3() {
	var s3 = new(test_profile)
	s3.name = "hhh"
	s3.age = 23
	println(s3.name)
}

func t2() {
	var s2 test_profile
	s2.age = 10
	s2.name = "john"
	s2.hobbies = []string{"cat", "dog"}
	fmt.Println(s2)
}

func t1() {
	s1 := test_profile{name: "simith", age: 10, hobbies: []string{"basketball"}}
	fmt.Println("name = ", s1.name)
	fmt.Println("age = ", s1.age)
	fmt.Println("hobbies = ", s1.hobbies)
}

// ===============================================================

type test_test1 struct {
	name  string
	age   int
	child test_test2
}

type test_test2 struct {
	childName string
	childAge  int
}

func (test_test1) get_child(name string, age int) *test_test1 {
	pp := test_test1{name: name, age: age}
	cc := test_test2{childName: name + "child", childAge: age - 1}
	pp.child = cc
	return &pp
}
